//
//  BaseViewController.m
//  项目唯一
//
//  Created by 谌桃 on 16/7/6.
//  Copyright © 2016年 ryan.chen. All rights reserved.
//

#import "BaseViewController.h"
#import "UIViewController+JASidePanel.h"

@interface BaseViewController ()

@end

@implementation BaseViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.view.backgroundColor = [UIColor whiteColor];
    
    //设置左侧按钮
    [self setUpLeftButtonItem];
}

- (void)setUpLeftButtonItem{

    UIButton * leftBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 40, 40)];
    [leftBtn setImage:[UIImage imageNamed:@"JianTou"] forState:UIControlStateNormal];
    [leftBtn addTarget:self action:@selector(goBack) forControlEvents:UIControlEventTouchUpInside];
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:leftBtn];
}

- (void)goBack{

    [self.navigationController popViewControllerAnimated:YES];
}

#pragma get method
- (UIViewController *)leftMenuViewController{

    return self.sidePanelController.leftPanel;
}

- (UINavigationController *)centerNavigationController{

    return (UINavigationController *)self.sidePanelController.centerPanel;
}

#pragma jumpToOtherVC
- (void)jumpToOtherViewController:(UIViewController *)otherVC{

    //显示中间的 panel
    [self.sidePanelController showCenterPanelAnimated:YES];
    
    //push 到指定的 VC
    
    [[self centerNavigationController] pushViewController:otherVC animated:YES];

}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
